<template>
	<uni-popup ref="popup" class="call-service-pop" type="bottom" @change="onChange">
		<view class="content">
			<view class="item">客服微信:{{phoneNum}}</view>
			<view class="item" @click="call">打电话:{{phoneNum}}</view>
			<button class="btn btn-yellow" @click="hide">取消</button>
		</view>
	</uni-popup>
</template>

<script>
import uniPopup from '../uni-popup/uni-popup.vue';

export default {
	components: {
		uniPopup,

	},
	props: {
		show: {
			type: Boolean,
			default: false
		}
	},
	watch: {
		show: function(newVal, oldVal) {
			// 显示或隐藏
			if (newVal) this.$refs.popup.open();
			else this.$refs.popup.close();
		}
	},
	data() {
		return {
			phoneNum:"15868088888" //电话号码
		};
	},
	methods: {
		onChange(even){
			// console.log("change",even)
			this.$emit("update:show",even.show)
		},
		call() {
			// 打电话
			uni.makePhoneCall({
			    phoneNumber: this.phoneNum //仅为示例
			});
		},
		hide(){
			this.$emit("update:show",false)
		}
	}
};
</script>

<style lang="scss" scoped>
.call-service-pop {
	.content {
		padding: 20rpx 0rpx;
		width: 100%;
		background-color: #fff;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		.item {
			width: 100%;
			padding: 10rpx;
			box-sizing: border-box;
			font-size: 36rpx;
			// font-weight: bolder;
			color: #232323;
			text-align: center;
			// padding-top: 20rpx;
		}
		
		.btn {
			border: 0;
			width: 80%;
			padding: 10rpx;
			font-size: 34rpx;
			margin-top: 20rpx;
		}
	}
}
</style>
